package com.hspedu.date_;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/2/5
 * @time 16:46
 */
public class Date01 {
    public static void main(String[] args) {
        Date date = new Date();
        System.out.println(date);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(sdf.format(date));
        try {
            Date parse = sdf.parse("2022-2-22 00:00:00");
            System.out.println(sdf.format(parse));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }
}
